import pandas as pd

def three_lin_table(filename, header = True, index = None):
    strs = "toprule\n"

    if header:
        data = pd.read_csv(filename)

        nums = len(data.columns)
        for i,col in enumerate(data.columns):
            strs = "\\textbf{"+col+"}"
            if i < nums - 1: 
                strs+= " & "
            else:
                strs+= " \\\\"
        strs+="\n"
        strs+="midrule\n"
    else:
        data = pd.read_csv(filename, header=None)

    if index is None:
        index = []

    for i in range(data.shape[0]):
        for j in range(data.shape[1]):
            if j in index:
                strs+=("\\textbf{"+data.iloc[i,j]+"}")

            else:
                strs+=str(data.iloc[i,j])

            if j < data.shape[1] - 1:
                strs+= " & "

            else:
                strs+= " \\\\"

        strs+="\n"

    strs+="bottomrule\n"

    


    


    
